package net.lzzy.spark;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

import java.util.List;

public class SparkMap {
    public static void main(String[] args) {
        SparkConf conf = new SparkConf().setAppName("SparkTextFile").setMaster(args[0]);
        JavaSparkContext javaSparkContext = new JavaSparkContext(conf);
        JavaRDD<String> javaRDD = javaSparkContext.textFile("hdfs://wgl-17045-hadoop:9000/"+args[1]);

        JavaRDD<Object> newRDD = javaRDD.map(item -> Integer.valueOf(item)+10);
        List<Object> list = newRDD.collect();
        for (Object s : list) {
            System.out.println(s);
        }
    }
}
